home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / fungetc.c < prev    next >
C/C++ Source or Header  |  1992-09-17  |  342b  |  17 lines

  1. /* from dlibs */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5.  
  6. int fungetc(c, fp)
  7.     int c;
  8.     register FILE *fp;
  9.     {
  10.     if((fp->_flag & (_IOERR | _IOEOF))    /* error or eof */
  11.     || (fp->_ptr <= fp->_base)        /* or too many ungets */
  12.     || (c < 0))                /* or trying to unget EOF */
  13.         return(EOF);
  14.     ++(fp->_cnt);
  15.     return(*--(fp->_ptr) = c);
  16.     }
  17.